-
Notifications
You must be signed in to change notification settings - Fork 790
[SYCL][NFC] Make kernel_impl::getAdapter()
return by reference
#19313
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
kernel_impl::getAdapter()
return by reference
091d314
to
ddfba84
Compare
ddfba84
to
f8e59fe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just the one question that is kind of general.
@@ -469,7 +469,7 @@ void handleErrorOrWarning(ur_result_t Error, const device_impl &DeviceImpl, | |||
|
|||
namespace detail::kernel_get_group_info { | |||
void handleErrorOrWarning(ur_result_t Error, ur_kernel_group_info_t Descriptor, | |||
const AdapterPtr &Adapter) { | |||
adapter_impl &Adapter) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to drop const
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, const
was on shared_ptr<adapter_impl>
and not the adapter_impl
object itself. Ensuring const-correctness on adapter_impl
object throughout the code would be orthogonal to the refactoring work that I'm doing and it's not trivial (I tried that before). So, for uniformity, throughout the refactoring, I've replaced const AdapterPtr
with adapter_impl
.
With that said, for the handleErrorOrWarning
function specifically, since adapter_impl
object is not passed around anywhere, I can add const adapter_impl&
if that's desirable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uniformity is fine with me. Thanks for the explanation!
@@ -31,8 +31,7 @@ void handleErrorOrWarning(ur_result_t, const device_impl &, ur_kernel_handle_t, | |||
|
|||
namespace kernel_get_group_info { | |||
/// Analyzes error code of urKernelGetGroupInfo. | |||
void handleErrorOrWarning(ur_result_t, ur_kernel_group_info_t, | |||
const AdapterPtr &); | |||
void handleErrorOrWarning(ur_result_t, ur_kernel_group_info_t, adapter_impl &); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question again.
|
It's a part of larger refactoring effort to pass adapter via reference instead of pointer everywhere in the codebase.
Follow-up of:
#19186
#19184
#19187
#19202
#19299
#19312